package kaug.p2.interface_example;

import java.util.ArrayList;
import java.util.List;

/**
 * Class/interface example. See 
 * praktikumid.w09.p5.interface_example
 * package for fully commented code.
 * @author Ago
 *
 */
public class Main {

	public static void main(String[] args) {
		//Animal a = new Animal();
		Cat c = new Cat();

		Animal a = new Frog();
		a = new Goldfish();
		
		List<Animal> animals = new ArrayList<Animal>();
		animals.add(c);
		animals.add(a);
		animals.add(new Frog());
		
		for (Animal an : animals) {
			if (an instanceof Goldfish) {
				System.out.println("kala");
				Goldfish f = (Goldfish) an;
			}
			if (an instanceof IWaterAnimal) {
				System.out.println("water animal");
				IWaterAnimal wa = (IWaterAnimal) an;
				wa.swim();
				
				((IWaterAnimal) an).swim();
			}
		}

	}

}
